#include "../Tools/GLHeaders.hpp"
#include "InitGLFunc.hpp"
#include "../Global.hpp"

void InitGL(int Width, int Height){
  /* white ambient light at half intensity (rgba) */
  GLfloat LightAmbient[] = { 0.5f, 0.5f, 0.5f, 1.0f };
  /* super bright, full intensity diffuse light. */
  GLfloat LightDiffuse[] = { 0.8f, 0.8f, 0.8f, 1.0f };
  /* position of light (x, y, z, (position of light)) */
  GLfloat LightPosition[] = { 1.0f, 1.0f, 1.0f, 1.0f };
  
  //glEnable(GL_TEXTURE_2D);
  glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  glEnable(GL_BLEND);
  glClearColor(0.2f, 0.2f, 0.2f, 1.0f);
  glClearDepth(1.0);
  glDepthFunc(GL_LESS);
  glEnable(GL_DEPTH_TEST);
  glEnable(GL_CULL_FACE);
  glEnable(GL_COLOR_MATERIAL);
	glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
  glShadeModel(GL_SMOOTH);
  
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluPerspective(45.0f,(GLfloat)Width/(GLfloat)Height,0.1f,100.0f); 
  glMatrixMode(GL_MODELVIEW);

  glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient);  // add lighting. (ambient)
  glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse);  // add lighting. (diffuse).
  glLightfv(GL_LIGHT1, GL_POSITION,LightPosition); // set light position.
  glEnable(GL_LIGHT1); // turn light 1 on.
  glEnable(GL_LIGHTING); 
}

